package com.caregiver.watch.business.user.model.vo;

import com.caregiver.watch.business.user.model.dto.AccessToken;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;

import java.util.Objects;

/**
 * @Description:
 * @Author 疆戟
 * @Date 2025/8/15 22:09
 * @Version 1.0
 */
@Data
@Schema(title = "访问令牌")
public class AccessTokenVo {


    /**
     * 访问令牌
     */
    @Schema(description= "访问令牌")
    private String accessToken;
    /**
     * 令牌有效期（秒）
     */
    @Schema(description= "令牌有效期（秒）")
    private Long expiresIn;


    public static AccessTokenVo build(AccessToken accessToken) {
        if (Objects.isNull(accessToken)) {
            return null;
        }
        AccessTokenVo vo = new AccessTokenVo();
        vo.accessToken = accessToken.getAccessToken();
        vo.expiresIn = accessToken.getExpiresIn();
        return vo;
    }
}
